﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class EnemyHpProgress : MonoBehaviour {

    Transform target;
    float distance = 0.8F;
    Image progress;

    private void Awake()
    {
        progress = transform.Find("progress").GetComponent<Image>();
    }
    public void Init(Transform target)
    {
        this.target = target;
    }

    void LateUpdate()
    {
        if (target)//==if(target!=null)
        {
            transform.position = target.position + Vector3.down * distance;
        }
    }

    //设置血量进度
    public void SetProgress(float percent)
    {
        progress.fillAmount = percent;
    }


}
